package com.clear.honghefinance.common.exception;

import com.clear.honghefinance.common.enums.ApiResponseCodeEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * 处理异常
 */
@Getter
@Setter
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = 2612992235262400823L;

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
//    private String message;
    public BaseException(String message) {
        super(message);
        this.code = ApiResponseCodeEnum.SERVICE_ERROR.getCode();
    }

    public BaseException(String message, Throwable t) {
        super(message, t);
        this.code = ApiResponseCodeEnum.SERVICE_ERROR.getCode();
    }

    public BaseException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(Integer code, String message, Throwable t) {
        super(message, t);
        this.code = code;
    }
}
